-
Notifications
You must be signed in to change notification settings - Fork 29
Hibernation/Resume testing #290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: resume
Are you sure you want to change the base?
Conversation
|
Squashed the 4 commits that I originally submitted so it makes a bit more sense |
|
Separate the hibernate/resume test code into a different module called |
|
Finally got that fix in for the script and reworked the way it handles the test-specific variables a bit, got stuck for a while on the latter. Originally I tried to include them all as I'm not entirely sure if it's the correct way to go about implementing it, but I thought this way it's a bit cleaner and says out of the way of other modules as much as possible :) |
builds successfully, but still need to figure out why qemu fails
- added a resume test to `test_image` which does a simple hibernate/resume of the VM, and triggers a panic if it fails - removed "-no-reboot" parameter, needed for full resume test, and added a check for kernel panic messages to stop QEMU from rebooting indefinitely - changed default size of test_rootfs from 16M to 256M to allow 128M of swap for testing (left 128M for disk as it's necessary for certain filesystem, like btrfs which enforces minimum partition size of 40M) - `test_resume` parameter (off by default), enables most of the extra functionality for resume testing - wrote a `resume_tests` function for the `test_image` with script to very hibernate/reboot returns to the same point - rearranged functions in the `test_image` module so that the `test_flag` is printed in the `init_final` stage in the `complete_tests` function, allows tests in `init_main` to be run before passing - changed shebang for `test_image` module to include "-l" to load `/etc/profile` in the test image - added the `swapon` binary to the `test_image`, so the resume swap file can be mounted before hibernation quick format fixes for previous commit
- added the `test_modules` parameter to to specify which modules to include in test image. - the `test_resume` parameter now includes the extra hibernate/resume testing function - including swap in the test image now works off the `test_swap_uuid` parameter, so it's less dependent on the resume module. would still be ideal to fix up the code that builds the swap at some point.
- converted `test_cmdline` to a NoDupFlatList to allow modules to append parameters more easily - made script in `test_resume` posix compliant, removed use of "local", "source" and (technically compliant, but not universally supported) redirects - attempted to clean up test-specific variables that are appended to by the resume module.
it enables late resume, but doesn't really create the conditions to test it, could make it work with cryptsetup
Adds a function to test hibernation/resume in QEMU during testing, had to make a few changes to the testing code to get it to work property:
removed the
-no-rebootparameter from the QEMU cmdline, as it needs to be able to reboot internally to work. Initially I considered using thetest_resumefunction in/sys/power/disk, however this just seems to hang QEMU :(the
testmodule now also checks for the kernel panic dmesg line from QEMU, since without the-no-rebootarg it will just hang or reboot if it panics.-
test_flagis now printed at the end of the test rootfs script in theinit_finalstage, to enable adding functions to theinit_mainstage.added a
resume_testsfunction to thetest_imagemodule (which can be activated by thetest_resumeparameter), which will hibernate the kernel and trigger a reboot. The test is successful if it continues from the same point in the script after resume.the
test_resumeparameter also activates extra code in thetest_imagebuilder that usessgdiskto configure a swap partition (this was added in a previous PR). Current this partition is not within the encrypted section of the disk, in future it would ideally detect the users layout and somewhat-mimic that on the test disk.changed the default size of the test rootfs disk to 256M, from 16M. I needed to include 128M for the swap to ensure it doesn't run out of memory when hibernating (this is technically not enough for all the RAM, but the kernel shouldn't need more if it's just running a single bash script as init). This also adds an extra 128M at the end for filesystems, as I found that things like Btrfs have a minimum size of 30-40M, so it would fail to build anyways.
changed the shebang for the test image to include
#!/bin/sh -l, as it now needs to import/etc/profilefor the extra test functionsI'm not sure whether enable the resume tests by default, I figured it's best not to in case it's not supported on a target system, auto-detection could be the next thing.
Also funny story, I spent a while rewriting the testing function to use the
subprocessmodule and read the QEMU output in real time, only rebase and find it had already been added. Teaches me to not leave rebasing till the end :)